package com.pro.framework.mq.rabbit;

import com.pro.framework.api.mq.IMqRabbitMqRoutingKey;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class MqRabbitPublisher {
    private final AmqpTemplate amqpTemplate;
    public void send(IMqRabbitMqRoutingKey routingKey, Object payload) {
        amqpTemplate.convertAndSend(EnumMqRabbitBaseExchange.APP.getName(), routingKey.getRoutingKeyAndQueue(), payload);
    }
}
